package edu.zut.cs.network.Experiment4;

import javax.swing.JOptionPane;
public class ConvertFeet_Meters {
    /**
     * Converts from feet(英尺) to meters(米)
     */
    public static double footToMeter(double foot) {
        double meter = 0.305 * foot;
        return meter;
    }

    /**
     * Converts from meters to feet
     */
    public static double meterToFoot(double meter) {
        double feet = meter / 0.305;
        return feet;
    }

    public static void main(String[] args) {
//        2	写一个类实现英尺与米的转换
        System.out.println("Feet          Meters     |      Meters        Feet");
        System.out.println("---------------------------------------------------");
        for (double i = 1.0; i < 11; i++) {
            double meter = ConvertFeet_Meters.footToMeter(i);
            double feet = ConvertFeet_Meters.meterToFoot((double) (i * 5 + 15.0));
            System.out.printf("%-5s         %-9s  |      %4s          %s", i, meter, (i * 5 + 15), feet);
            System.out.println();

        }


    }
}



